package com.demo.config;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author zhiqiang
 */
public class RabbitMqUtils {
        public  static Connection getConnection() throws IOException, TimeoutException {
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost("localhost");
            factory.setPort(5672);
            factory.setVirtualHost("/vhost_zdy");
            factory.setUsername("username");
            factory.setPassword("password");
            return factory.newConnection();
        }
    }
